package com.arthur.controller;

import com.arthur.entity.Dept;
import com.arthur.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptController_Consumer {
    @Autowired
    private DeptClientService deptClientService;
    //添加部门
    @RequestMapping(value = "/consumer/dept/add")
    public boolean addDept(Dept dept){
        return deptClientService.addDept(dept);
    }
    //根据id获取部门
    @RequestMapping(value = "/consumer/dept/find/{id}")
    public Dept findById(@PathVariable("id") Long id) {
        return deptClientService.findById(id);
    }
    //获取部门列表
    @RequestMapping(value = "/consumer/dept/list", method = RequestMethod.GET)
    public List<Dept> findAll() {
        return deptClientService.findAll();
    }
}
